var OnlineStoreTopAdminPanelModule = { initialize: function () { var module = this; $(document).on('click', '.exit-preview-mode', function (event) { module.exit_preview_mode(event); }); $(document).on('click', '.exit-maintenance-mode-unlocked', function (event) { module.exit_maintenance_mode_unlocked(event); }); }, exit_preview_mode: function (event) { var module = this; event.preventDefault(); event.stopPropagation(); OnlineStoreLoadingModule.show(); var data = {}; OnlineStoreApiModule.make_api_post_request_processing_data(ONLINE_STORE_API_EXIT_PREVIEW_MODE, data, function (response) { UtilModule.reload_without_query_string(); }, function (response) { OnlineStoreLoadingModule.hide(); if (typeof response.responseJSON !== 'undefined' && typeof response.responseJSON.errors !== 'undefined') { OnlineStoreErrorsModule.show(response.responseJSON.errors); return; } OnlineStoreErrorsModule.show_500_error(); }); }, exit_maintenance_mode_unlocked: function (event) { var module = this; event.preventDefault(); event.stopPropagation(); OnlineStoreLoadingModule.show(); var data = {}; OnlineStoreApiModule.make_api_post_request_processing_data(ONLINE_STORE_API_EXIT_MAINTENANCE_MODE_UNLOCKED, data, function (response) { UtilModule.reload_without_query_string(); }, function (response) { OnlineStoreLoadingModule.hide(); if (typeof response.responseJSON !== 'undefined' && typeof response.responseJSON.errors !== 'undefined') { OnlineStoreErrorsModule.show(response.responseJSON.errors); return; } OnlineStoreErrorsModule.show_500_error(); }); }, }; $(function () { OnlineStoreTopAdminPanelModule.initialize(); });